<?php include "htmlBase/header.php"; ?>

<?php
include_once "ViewBase.php";
$id_Responsavel = $_GET["id_Responsavel"];
$Entidades = MontarHeadPHP("PlanoDeAcao", true, "id_Responsavel = $id_Responsavel");

include_once 'Entidades/Responsavel.php';
$servicoResponsavel = new Responsavel();
$Responsavel = $servicoResponsavel->ObterPorId($id_Responsavel);

MontarHeadScript("PlanoDeAcao", "Cadastro", "Cadastro", "id_Responsavel=$id_Responsavel");
?>

<div class="page">
    <div class="page-header">
        <div class="page-header-content">
            <h1><span style="padding-left:80px">Plano de Ação</span> <small>(<?php echo $Responsavel->Nome; ?>)</small></h1>
            <a href="ResponsavelPainel.php?Id=<?php echo $Responsavel->Id; ?> "class="back-button big page-back"></a>
        </div>
        <div class="progress-bar" align="rigth">
            <div class="bar bg-color-blue" style="width: 75%"></div>
        </div>
    </div>
    <br/>
    <div class="page">
        <div class="page-region">
            <div class="page-region-content">

                <div style="width: 100%; overflow: auto; margin-bottom: 20px;">
                    <table class="hovered bordered">
                        <tr>
                            <th rowspan="2"></th>
                            <th rowspan="2">Estratégia de intervenção</th>
                            <th colspan="3">Ações a desenvolver</th>
                            <th rowspan="2">Prazo Intervenção</th>
                            <th colspan="2">Resultados</th>
                        </tr>
                        <tr>
                            <th>Cras</th>
                            <th>Família</th>
                            <th>Rede de Atendimento</th>                            
                            <th>Esperados</th>
                            <th>Obtidos</th>
                        </tr>
                        <?php
                        if ($Entidades == null)
                        {
                            ?>
                            <tr>
                                <td colspan="8">
                                    <h3 style="text-align:center">Sem Resultado</h3>
                                </td>
                            </tr>
                            <?php
                        } else
                        {
                            foreach ($Entidades as $PlanoDeAcao)
                            {
                                ?>
                                <tr onclick="Selecionar(<?php echo $PlanoDeAcao->Id; ?>)">
                                    <td width="1"><input type="radio" name="RadioId" Id="<?php echo $PlanoDeAcao->Id; ?>" value="<?php echo $PlanoDeAcao->Id; ?>"></td>
                                    <td><?php echo $PlanoDeAcao->EstrategiaIntervencao; ?></td>
                                    <td><?php echo $PlanoDeAcao->getNomeCras(); ?></td>
                                    <td><?php echo $PlanoDeAcao->getNomeFamilia(); ?></td>
                                    <td><?php echo $PlanoDeAcao->getNomeRedeAtendimento(); ?></td>
                                    <td><?php echo $PlanoDeAcao->getNomePrazoIntervencao(); ?></td>
                                    <td><?php echo $PlanoDeAcao->ResultadoEsperado; ?></td>
                                    <td><?php echo $PlanoDeAcao->ResultadoObtidos; ?></td>
                                </tr>
                                <?php
                            }
                        }
                        ?>
                    </table>
                </div>

                <div class="input-control" style="margin-left: auto; margin-right: auto;">
                    <button class="standart default" onclick="Novo()">Novo</button>
                    <button class="standart" onclick="Alterar()">Alterar</button>
                    <button class="standart" onclick="Excluir()">Excluir</button>
                    <a href="ResponsavelPainel.php?Id=<?php echo $Responsavel->Id; ?>" class="button standart bg-color-lighten" style="float: right">Voltar</a>
                </div>

            </div>
        </div>
    </div>

</div>

<?php include "htmlBase/footer.php"; ?>
